package com.hrms.service.impl;

import com.hrms.domain.Department;
import com.hrms.mapper.DepartmentMapper;
import com.hrms.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:zhao xinyu
 * @date: 2024/12/19 - 09:07
 * @mail: zxy1277692924@outlook.com
 * @info:
 */
@Service
public class DepartmentServiceImpl implements DepartmentService{

    @Autowired
    private DepartmentMapper departmentMapper;

    @Override
    public List<Department> queryList() {
        return departmentMapper.selectList();
    }

    @Override
    public Department queryDeptByNo(Integer deptNo) {
        if (deptNo == null || deptNo == 0){
            return null;
        }
        return departmentMapper.selectOne(deptNo);
    }

    @Override
    public int saveDept(Department department) {
        if (department == null){
            return 0;
        }
        return departmentMapper.insert(department);
    }


}
